﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using simpleHotel.Business;
using simpleHotel.Data;

namespace simpleHotel.Business
{
    public class Contacts
    {
        public List<Contact> getContact()
        {
            List<Contact> data = new List<simpleHotel.Business.Contact>();
            var contacts = from contact in Singleton.DataContext.Contacts
                           select contact;
            foreach (simpleHotel.Business.Contact item in contacts)
            {
                data.Add(item);
            }
            return data;
        }

        public void InsertContact(Contact contact)
        {
            var model = Singleton.DataContext;
            Contact contacts = new Contact()
            {
                Title = contact.Title,
                FullName = contact.FullName,
                Email = contact.Email,
                EmailContent = contact.EmailContent,
                CreatedDate = DateTime.Now
            };

            model.Contacts.InsertOnSubmit(contacts);           
        }
    }
}
